﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
//using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace CustomControls
{
    public partial class HB_Template_Control : UserControl
    {
        private int cIndex;
        public bool clicked;
        public bool inserted;
        private Color classColor;

        public event EventHandler<MouseEventArgs> ControlClicked;

        public HB_Template_Control()
        {
            InitializeComponent();
            //this.ResizeRedraw = true;
            cIndex = -1;
            
        }

        public Image Image
        {
            get
            {
                return this.pictureBox1.Image;
            }
            set
            {
                this.pictureBox1.Image = value;
            }
        }
        public int PicBoxWidth
        {
            get
            {
                return this.groupBox.Width;
            }
            set
            {
                this.groupBox.Width = value;
            }
        }
        public int PicBoxHeight
        {
            get
            {
                return this.groupBox.Height;
            }
            set
            {
                this.groupBox.Height = value;
            }
        }
        public PictureBoxSizeMode SizeMode
        {
            get
            {
                return this.pictureBox1.SizeMode;
            }
            set
            {
                this.pictureBox1.SizeMode = value;
            }
        }
        public String Text_Box
        {
            get
            {
                return this.groupBox.Text;

            }
            set
            {
                this.groupBox.Text = value;
            }
        }
        public String Text_Width
        {
            get
            {
                return this.TB_Width.Text;
            }
            set
            {
                this.TB_Width.Text = value;
            }
        }
        public String Text_Height
        {
            get
            {
                return this.TB_Height.Text;
            }
            set
            {
                this.TB_Height.Text = value;
            }
        }
        public String Text_Quality
        {
            get
            {
                return this.TB_Quality.Text;
            }
            set
            {
                this.TB_Quality.Text = value;
            }
        }
        public String Text_Size
        {
            get
            {
                return this.TB_Name.Text;
            }
            set
            {
                this.TB_Name.Text = value;
            }
        }
        public int controlIndex
        {
            get
            {
                return this.cIndex;
            }
            set
            {
                this.cIndex = value;
            }
        }
        public Color classificationColor
        {
            get
            {
                return this.classColor;
            }
            set
            {
                this.classColor = value;
                B_Color.BackColor = value;
            }
        }
        private void pictureBox1_MouseDown(object sender, MouseEventArgs e)
        {
            //Weiteres Event feuern, so dass in der Zellform das clicked-Property der anderen Controls zurückgesetzt wird
            EventHandler<MouseEventArgs> controlClicked = this.ControlClicked;
            if (controlClicked != null)
            {
                controlClicked(this, e);
            }

            if (e.Button == MouseButtons.Right)
                clicked = true;
            
        }

        private void B_Color_Click(object sender, EventArgs e)
        {
            if (colorDialog.ShowDialog() != DialogResult.Cancel)
            {
                B_Color.BackColor = colorDialog.Color;
                classColor = colorDialog.Color;
            }
        }
    }
}
